﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SistemaControleOrcamentario.Forms
{
    public partial class Transferencia : Form
    {
        public Transferencia()
        {
            InitializeComponent();
        }


        private void Transferencia_Load(object sender, EventArgs e)
        {
            cbContaDestino.DataSource = DataLayer.Model.Conta.GetAll().OrderBy(p => p.Descricao).ToList();
            cbContaOrigem.DataSource = DataLayer.Model.Conta.GetAll().OrderBy(p => p.Descricao).ToList();
        }

        private void btnLancar_Click(object sender, EventArgs e)
        {
            DataLayer.Model.Transferencia trans = new DataLayer.Model.Transferencia();
            trans.ContaDestino = (DataLayer.Model.Conta)cbContaDestino.SelectedValue;
            trans.ContaOrigem = (DataLayer.Model.Conta)cbContaOrigem.SelectedValue;
            trans.Valor = decimal.Parse(txtValor.Text);
            trans.Salvar();
        }
    }
}
